import { post, get } from '@/utils/request';
import { Agent, ModelOption, VectorKnowledge, ReferenceFunction } from '@/pages/backhub/agent/store/agentTypes';

/**
 * 获取智能体列表
 * @returns 智能体列表
 */
export const getAgentList = async (): Promise<Agent[]> => {
  return get('/engine/starhub/agent/getList');
};

/**
 * 创建智能体
 * @param data 智能体数据
 * @returns 创建的智能体
 */
export const createAgent = async (data: Partial<Agent>): Promise<Agent> => {
  return post('/engine/starhub/agent/add', data);
};

/**
 * 获取智能体
 * @returns 智能体信息
 */
export const getInfo = async (id: string): Promise<Agent[]> => {
  return get(`/engine/starhub/agent/getInfo/${id}`);
};

/**
 * 更新智能体
 * @param id 智能体ID
 * @param data 更新的数据
 * @returns 更新后的智能体
 */
export const updateAgent = async (id: string, data: Partial<Agent>): Promise<Agent> => {
  data.id = id;
  return post(`/engine/starhub/agent/update`, data);
};

/**
 * 删除智能体
 * @param id 智能体ID
 */
export const deleteAgent = async (ids: string): Promise<void> => {
  return post(`/engine/starhub/agent/delete`, { ids });
};


/**
 * 获取向量库列表
 * @returns 向量库列表
 */
export const getVectorList = async (): Promise<VectorKnowledge[]> => {
  return get('/engine/starhub/milvus/getList');
};

/**
 * 获取函数列表
 * @returns 函数列表
 */
export const getFunctionList = async (): Promise<ReferenceFunction[]> => {
  return get('/engine/starhub/function/page');
};


/**
 * 获取模型列表
 * @returns 模型列表
 */
export const getActiveModel = async (): Promise<any[]> => {
  return get(`/engine/starhub/model/getActiveModel`);
};